package org.example.object.clone;

public class Demo {
    public static void main(String[] args) throws CloneNotSupportedException {
        Person person = new Person("John", new Address("123 Main St Springfield USA"));
        Person cloned = (Person) person.clone();

        cloned.setName("Jane");
        cloned.getAddress().setStreet("New York");

        System.out.println(person.getName());
        System.out.println(person.getAddress().getStreet());
        System.out.println(cloned.getName());
        System.out.println(cloned.getAddress().getStreet());
    }
}
